using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAO;
using System.Data;

namespace BUS
{
    /// <summary> 
    ///Author: nnamthach@gmail.com 
    /// <summary>
    public class SSRFANVControl
    {
        #region Local Variable
        private SSRFANVDataAccess _SSRFANVDAO;
        #endregion Local Variable

        #region Method
        public SSRFANVControl()
        {
            _SSRFANVDAO = new SSRFANVDataAccess();
        }

        public SSRFANVInfo Get_SSRFANV(
            String SUN_DB
        , ref string sErr)
        {
            return _SSRFANVDAO.Get_SSRFANV(
            SUN_DB
            , ref sErr);
        }

        public DataTable GetAll_SSRFANV(ref string sErr)
        {
            return _SSRFANVDAO.GetAll_SSRFANV(ref sErr);
        }

        public DataTable GetAll_SSRFANVBU(String CATEGORY, String SUN_DB, ref string sErr, string connect)
        {
            return _SSRFANVDAO.GetAll_SSRFANVBU(CATEGORY, SUN_DB, ref sErr, connect);
        }

        public Int32 Add_SSRFANV(SSRFANVInfo obj, ref string sErr, string connect = null)
        {
            return _SSRFANVDAO.Add_SSRFANV(obj, ref sErr, connect);
        }

        public string Update_SSRFANV(SSRFANVInfo obj)
        {
            return _SSRFANVDAO.Update_SSRFANV(obj);
        }

        public string Delete_SSRFANV(
            String SUN_DB
        )
        {
            return _SSRFANVDAO.Delete_SSRFANV(
            SUN_DB
            );
        }
        public Boolean IsExist_SSRFANV(
            String SUN_DB, String CATEGORY, String CODE, string connect = null
        )
        {
            return _SSRFANVDAO.IsExist_SSRFANV(
            SUN_DB, CATEGORY, CODE, connect
            );
        }

        /*  public string Delete_SSRFANV(String arrID)
          {
              string kq = "";
              string[] arrStrID = arrID.Split(',');
              foreach (string strID in arrStrID)
              {
                  if (strID != "")
                  {
                      int ID = Convert.ToInt32(strID);
                      kq += _SSRFANVDAO.Delete_SSRFANV(ID);
                  }
              }
              return kq;
          } */

        public DataTable Search(String columnName, String columnValue, String condition, ref String sErr)
        {
            return _SSRFANVDAO.Search(columnName, columnValue, condition, ref  sErr);
        }

        #endregion Method


        public bool IsExist(string db, string cate, string code, string connect = null)
        {
            return IsExist_SSRFANV(db, cate, code, connect);
        }

        public int Add(SSRFANVInfo info, ref string sErr, string connect = null)
        {
            return Add_SSRFANV(info, ref sErr, connect);
        }
    }
}
